<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateTransfersTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up()
    {
        Schema::create('trading_transfers', function (Blueprint $table) {
            $table->increments('id')->comment('资金划转ID');
            $table->unsignedInteger('user_id')->comment('用户ID');
            $table->unsignedInteger('coin_id')->comment('币种ID');
            $table->unsignedDecimal('number', 20, 8)->comment('划转数量');
            $table->enum('from_account', ['account', 'contract_account', 'otc_account','activity_account'])->comment('划转自');
            $table->enum('to_account', ['account', 'contract_account', 'otc_account','activity_account'])->comment('划转至');
            $table->timestamp('time')->nullable()->useCurrent()->comment('时间');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down()
    {
        Schema::dropIfExists('trading_transfers');
    }
}
